package com.wqtz.chechai.view.activities;

import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.wqtz.chechai.R;
import com.wqtz.chechai.adapter.TimeAdapter;
import com.wqtz.chechai.base.BaseActivity;
import com.wqtz.chechai.presenter.BasePresent;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 项目名称： CheChai
 * 创建人 : Liberation
 * 创建时间: 2016/12/29 16:23
 */
public class CarStatusActivity extends BaseActivity implements TimeAdapter.itemClickCallBack {
	TimeAdapter mTimeAdapter;
	List<String> mList;
	@BindView(R.id.iv_back)
	ImageView mIvBack;
	@BindView(R.id.tv_title)
	TextView mTvTitle;
	@BindView(R.id.lv)
	ListView mLv;

	@Override
	public void init() {
		ButterKnife.bind(this);
		mList = new ArrayList<>();
		mList.add("优秀");
		mList.add("一般");
		mList.add("较差");
		mTimeAdapter = new TimeAdapter(R.layout.item_time_select);
		mTimeAdapter.addData(mList);
		mLv.setAdapter(mTimeAdapter);
		mTimeAdapter.setCallBack(this);
	}

	@Override
	public void loadData() {

	}

	@Override
	public int setContentViews() {
		return R.layout.activity_carstatus;
	}

	@Override
	public BasePresent createPresenter() {
		return null;
	}



	@OnClick(R.id.iv_back)
	public void onClick() {
		finish();
	}


	@Override
	protected void onResume() {
		super.onResume();
		activitys.add(this); //添加当前的activity
	}

	@Override
	public void itemClick(int position) {
		Intent intent = new Intent();
		intent.putExtra("status", mList.get(position));
		intent.putExtra("level",position+1+"");
		setResult(RESULT_OK, intent);
		this.finish();
	}
}
